package tests;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import java.util.HashSet;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import base.items.Mp3;



public class Mp3Test {
	private Mp3 m=null;
	private HashSet<Integer> tags = new HashSet<Integer>();
	private HashSet<Integer> comments = new HashSet<Integer>();

	@Before
	public void setup(){
	}

	@After
	public void tearUp(){
		m=null;
		tags=null;
	}

	@Test
	public void constructorNotNull(){
		m=new Mp3(0, "Tik Tok", tags,comments,"Keisha",3.22,196);
		assertNotNull(m);
	}

	@Test (expected=IllegalArgumentException.class)
	public void constructorValidId(){
		m=new Mp3(-1, "Tik Tok", tags,comments,"Keisha",3.22,196);
	}
	
	@Test
	public void correctType(){
		m=new Mp3(0, "Tik Tok", tags,comments,"Keisha",3.22,196);
		String actual = m.getType();
		String expected = "Music";
		assertTrue(expected.equals(actual));
	}
	
	@Test
	public void toStringOk(){
		tags.add(1);
		m=new Mp3(0, "Tik Tok", tags,comments,"Keisha",3.22,196);
		String actual = m.toString();
		String expected = "Item Id: 0" +
				"\nType: Mp3"+
				"\nTitle: Tik Tok" +
				"\nArtist: Keisha" +
				"\nLength: 3.22 min"+
				"\n\t* Tag n°" + 1;
		assertTrue(expected.equals(actual));
	}
	
	
}
